#pragma once
/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * Directory Class
 *      Provides access to specific directory management functions.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
#include "stdafx.h"

using namespace System;
using namespace System::Collections;

namespace Adaptive
{
	namespace Foundation
	{
		namespace IO
		{
			/// <summary>
			/// Provides access to specific directory management functions.
			/// </summary>
			public ref class IoDirectory sealed
			{
			public:
 
				/*--------------------------------------------------------------------------------
				 * Public Methods / Functions
				 *------------------------------------------------------------------------------*/
				#pragma region Public Methods / Functions
				/// <summary>
				/// Gets the free space information for the specified drive.
				/// </summary>
				/// <remarks>
				/// This is a wrapper method for the C <see cref="_getdiskfree"/> function.
				/// </remarks>
				/// <param name="driveLetter">The letter of the drive to examine.</param>
				/// <returns>
				/// A populated <see cref="DiskFreeInfo"/> structure if successful, otherwise, returns
				/// an empty structure.
				/// </returns>
				static DiskFreeInfo GetDiskFree( String^ driveLetter );
				/// <summary>
				/// Gets the free space information for the specified drive.
				/// </summary>
				/// <remarks>
				/// This is a wrapper method for the C <see cref="_getdiskfree"/> function.
				/// </remarks>
				/// <param name="driveLetter">The letter of the drive to examine.</param>
				/// <returns>
				/// A populated <see cref="DiskFreeInfo"/> structure if successful, otherwise, returns
				/// an empty structure.
				/// </returns>
				static DiskFreeInfo GetDiskFree( Char driveLetter );
				/// <summary>
				/// Gets the free space information for the specified drive.
				/// </summary>
				/// <remarks>
				/// This is a wrapper method for the C <see cref="_getdiskfree"/> function.
				/// </remarks>
				/// <param name="driveNumber">The number of the drive to examine.</param>
				/// <returns>
				/// A populated <see cref="DiskFreeInfo"/> structure if successful, otherwise, returns
				/// an empty structure.
				/// </returns>
				static DiskFreeInfo GetDiskFree( int driveNumber );
				/// <summary>
				/// Gets the list of drives on the system.
				/// </summary>
				/// <remarks>
				/// This is a wrapper method for the C <see cref="_getdrives"/> function.
				/// </remarks>
				/// <returns>
				/// A <see cref="BitArray"/> instance containing the bits of the bitmask identifying the 
				/// drives that are present.
				/// </returns>
				static BitArray^ GetDrives();
				/// <summary>
				/// Gets the list of drives on the system.
				/// </summary>
				/// <remarks>
				/// This is a wrapper method for the C <see cref="_getdrives"/> function.
				/// </remarks>
				/// <returns>
				/// A long value containing the bitmask identifying the 
				/// drives that are present.
				/// </returns>
				static unsigned long GetDrivesAsLong();
				/// <summary>
				/// Searches for a file using environment paths.
				/// </summary>
				/// <remarks>
				/// This is a wrapper method for the C <see cref="_searchenv"/> function.
				///
				/// The <b>SearchEnviron</b> routine searches for the target file in the specified domain. 
				/// The <i>variableName</i> variable can be any environment or user-defined variable that 
				/// specifies a list of directory paths, such as PATH, LIB, and INCLUDE. Because <b>SearchEnviron</b> is 
				/// case-sensitive, <i>variableName</i> should match the case of the environment variable.
				/// </remarks>
				/// <param name="fileName">Name of the file to search for.</param>
				/// <param name="variableName">Environment to search.</param>
				/// <returns>
				/// The routine searches first for the file in the current working directory. If it does not find the file, 
				/// it looks next through the directories specified by the environment variable. If the target file is in one 
				/// of those directories, the newly created path is returned. If the filename file is not found, 
				/// an empty string is returned.
				/// </returns>
				static String^ SearchEnviron(String^ fileName, String^ variableName);
				#pragma endregion

			private:
				/*--------------------------------------------------------------------------------
				 * Constructor / Dispose / Destructor Methods
				 *------------------------------------------------------------------------------*/
				#pragma region Constructor / Dispose / Destructor Methods
				/// <summary>
				/// Initializes a new instance of the class.
				/// </summary>
				/// <remarks>
				/// This is the default constructor.
				/// </remarks>
				IoDirectory();
				#pragma endregion

			};
		}
	}
}